#ifndef GAMESTATE_H
#define GAMESTATE_H

#include <QObject>
#include <QQmlEngine>

class GameState : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QList<int> cards READ cards NOTIFY cardsChanged)
    Q_PROPERTY(int difty READ difty WRITE setDifty NOTIFY diftyChanged)
    Q_PROPERTY(int column READ column NOTIFY columnChanged)
    QML_ELEMENT
public:
    explicit GameState(QObject *parent = nullptr);

    QList<int> cards() {return _cards;}

    int difty() {return _difty;}
    void setDifty(int difty) {_difty = difty; emit diftyChanged();}

    int column() {return _column;}

    Q_INVOKABLE void newLevel();

signals:
    void cardsChanged();
    void diftyChanged();
    void columnChanged();

private:
    QList<int> _cards;
    int _difty;
    int _column;

    void onDiftyChanged();
};

#endif // GAMESTATE_H
